package java6681.lesson15.score;

import java.util.Arrays;

public class Sport6681 implements Averageable6681 {
    @Override
    public double average(double[] d) {
        double sum = 0.0;
        double fistend = 0.0;
        double aver = 0.0;
//        排序
        Arrays.sort(d);
        for (int i = 0; i < d.length; i++) {
//            去掉一个最高分和最低分
            if (d[i] == d[0] || d[i] == d[d.length - 1]) {
                continue;
            } else {
                sum += d[i];
                fistend++;
            }

        }
        aver = sum / fistend;
        return aver;
    }
}
